/*package com.hy.mydesktop.client.mvc.dataload;

import java.util.ArrayList;
import java.util.Map;

import com.extjs.gxt.desktop.client.Desktop;
import com.extjs.gxt.ui.client.Registry;
import com.extjs.gxt.ui.client.data.BaseListLoadResult;
import com.extjs.gxt.ui.client.data.BaseListLoader;
import com.extjs.gxt.ui.client.data.BasePagingLoader;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.data.PagingLoadResult;
import com.extjs.gxt.ui.client.data.RpcProxy;
import com.extjs.gxt.ui.client.mvc.AppEvent;
import com.extjs.gxt.ui.client.mvc.Controller;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.hy.mydesktop.client.MyDesktop;
import com.hy.mydesktop.client.component.event.AppEvents;
import com.hy.mydesktop.client.mvc.base.BasePresenterAndView;
import com.hy.mydesktop.client.rpc.ServiceInvokerAsync;
import com.hy.mydesktop.client.rpc.reader.GxtToSeamServiceResultListReader;
import com.hy.mydesktop.client.rpc.reader.GxtToSeamServiceResultPagingReader;
import com.hy.mydesktop.shared.rpc.meta.GxtToSeamServiceParameter;
import com.hy.mydesktop.shared.rpc.meta.GxtToSeamServiceResult;
import com.hy.mydesktop.shared.rpc.util.RpcDebugUtil;

public class GridDataLoadPresenter extends BasePresenterAndView{

	private Desktop desktop = null;
	private Grid<ModelData> grid = null;
	
	private RpcProxy<GxtToSeamServiceResult> proxy = null;
//	private GxtToSeamServiceResultListReader<ModelData> reader =  new GxtToSeamServiceResultListReader<ModelData>();;
	private GxtToSeamServiceResultPagingReader<ModelData> pagingReader =  new GxtToSeamServiceResultPagingReader<ModelData>();;
	private GxtToSeamServiceResultListReader<GxtToSeamServiceResult> listReader = new GxtToSeamServiceResultListReader<GxtToSeamServiceResult>();
//	final ServiceInvokerAsync serviceInvoker = GWT.create(ServiceInvoker.class);
	final ServiceInvokerAsync serviceInvoker = Registry.get(MyDesktop.SERVICEINVOKER);
	final GxtToSeamServiceParameter gxtToSeamServiceParameter = new GxtToSeamServiceParameter();
	// 后台加载的数据loader
	private BaseListLoader<BaseListLoadResult<ModelData>> loader;
//	private ListLoader<BaseListLoadResult<ModelData>> loader;
	private BasePagingLoader<PagingLoadResult<ModelData>> pageLoader;
	
	public GridDataLoadPresenter(Controller controller) {
		super(controller);
	}

	@Override
	protected void handleEvent(AppEvent event) {
		
		
		

		// 读取事件中的所有数据信息
		Map<String, Object> map = event.getData();
		//EventStructureMetaModel eventStructureMetaModel =(EventStructureMetaModel)map.get("eventstructuremetamodel");
	
		// 0401
		if (AppEvents.LOAD_DATA_EVENT == event.getType()) {
			//拿到用于显示数据的表格
//			grid = (Grid<ModelData>) map.get("dataContainer");			
			grid = (Grid<ModelData>) map.get("grid");			
			System.out.println("GridDataLoadView---------  AppEvents.LOAD_DATA_EVENT");			
			//========================================================================		
//			loader = this.getBaseListLoader(gxtToSeamServiceParameter, reader);
			if (grid.getData("gridType")==null||(Integer)(grid.getData("gridType"))==1) {
				//对于可编辑表格
				//x
				//TODO 加载表格数据？？？？
				final GxtToSeamServiceParameter gxtToSeamServiceParameter = grid.getData("gxtToSeamServiceParameter");
				int getAll = gxtToSeamServiceParameter.getServiceMethodName().indexOf("getAll");
				if (getAll==0) {
					gxtToSeamServiceParameter.setMethodArguments(null);
				}
				
				
				RpcDebugUtil.printGxtToSeamServiceParameterOfRpc(getClass(),gxtToSeamServiceParameter);
				
				if (gxtToSeamServiceParameter!=null) {
					proxy = new RpcProxy<GxtToSeamServiceResult>(){

						@Override
						protected void load(Object loadConfig,
								AsyncCallback<GxtToSeamServiceResult> callback) {
							serviceInvoker.callService(gxtToSeamServiceParameter, callback);
						}};
					  
					loader =  new  BaseListLoader<BaseListLoadResult<ModelData>>(proxy,listReader);
		 
					ListStore<ModelData> listStore = new ListStore<ModelData>(loader);
					
					listStore.getLoader().load();
					final ColumnModel cm = grid.getColumnModel();
					grid.reconfigure(listStore, new ColumnModel(new ArrayList<ColumnConfig>()));
					//设置显示行号
					if ((Boolean)(grid.getData("showRowNumberer"))!=null) {
						this.showRowNumber(grid, cm);
					}
					grid.reconfigure(listStore, cm);
					listStore.getLoader().load();
				}else {
					final ColumnModel cm = grid.getColumnModel();
					final  ListStore<ModelData> listStore = new ListStore<ModelData>();
					listStore.insert(new BaseModel(), 0);
					grid.reconfigure(listStore, cm);
				}
				
				gxtToSeamServiceParameter.setServiceComponentName("com.hy.mydesktop.server.business.PersonService");
				gxtToSeamServiceParameter.setServiceMethodName("listPerson3");
				ModelData[] methodArguments2 = new BaseModelData[1];
				methodArguments2[0] = new BaseModel();
				gxtToSeamServiceParameter.setMethodArguments(methodArguments2 );
				grid.reconfigure(listStore, new ColumnModel(new ArrayList<ColumnConfig>()));
				
				final List<ColumnConfig> list = new LinkedList<ColumnConfig>();
				serviceInvoker.callService(gxtToSeamServiceParameter,
						new AsyncCallback<GxtToSeamServiceResult>() {

							@Override
							public void onSuccess(GxtToSeamServiceResult result) {
								List<BaseModel> bmBaseModels = new LinkedList<BaseModel>();
								ModelData modelData = result.getResult();
								bmBaseModels = modelData.get("listOfModelData");
															
								for (BaseModel baseModel : bmBaseModels) {
									ColumnConfig columnConfig = new ColumnConfig();
									columnConfig.setId((String)baseModel.get("id"));
									columnConfig.setHeader((String)baseModel.get("header"));
									columnConfig.setWidth((Integer)baseModel.get("width"));
									columnConfig.setEditor(new CellEditor(new TextField<String>()));
									list.add(columnConfig);
								}
								
								ColumnModel cm2  = new ColumnModel(list);
								grid.reconfigure(listStore, cm2);
								
							}

							@Override
							public void onFailure(Throwable caught) {
								System.out.println("------Rpc Exception is ####"+caught +"When get the Grid's ColumnModel");
								caught.printStackTrace();
							}
						});
			}
			else if ((Integer)(grid.getData("gridType"))==5) {
				//对于只读表格
				
				final GxtToSeamServiceParameter gxtToSeamServiceParameter = grid.getData("gxtToSeamServiceParameter");
				int getAll = gxtToSeamServiceParameter.getServiceMethodName().indexOf("getAll");
				if (getAll==0) {
					gxtToSeamServiceParameter.setMethodArguments(null);
				}
				gxtToSeamServiceParameter.setServiceComponentName("com.hy.mydesktop.server.business.PersonService");
				gxtToSeamServiceParameter.setServiceMethodName("listPerson2");
				BaseModel[] methodArguments = new BaseModel[1];
				methodArguments[0] = new BaseModel();
				gxtToSeamServiceParameter.setMethodArguments(methodArguments );	
				if (gxtToSeamServiceParameter!=null) {
					proxy = new RpcProxy<GxtToSeamServiceResult>(){

						@Override
						protected void load(Object loadConfig,
								AsyncCallback<GxtToSeamServiceResult> callback) {
							serviceInvoker.callService(gxtToSeamServiceParameter, callback);
						}};
					  
					loader =  new  BaseListLoader<BaseListLoadResult<ModelData>>(proxy,listReader);
		 
					ListStore<ModelData> listStore = new ListStore<ModelData>(loader);
					
					listStore.getLoader().load();
					final ColumnModel cm = grid.getColumnModel();
					grid.reconfigure(listStore, new ColumnModel(new ArrayList<ColumnConfig>()));
					//设置显示行号
					if ((Boolean)(grid.getData("showRowNumberer"))!=null) {
						this.showRowNumber(grid, cm);
					}
					grid.reconfigure(listStore, cm);
					listStore.getLoader().load();
				}else {
					final ColumnModel cm = grid.getColumnModel();
					final  ListStore<ModelData> listStore = new ListStore<ModelData>();
					listStore.insert(new BaseModel(), 0);
					grid.reconfigure(listStore, cm);
				}
				
				gxtToSeamServiceParameter.setServiceComponentName("com.hy.mydesktop.server.business.PersonService");
				gxtToSeamServiceParameter.setServiceMethodName("listPerson3");
				ModelData[] methodArguments2 = new BaseModelData[1];
				methodArguments2[0] = new BaseModel();
				gxtToSeamServiceParameter.setMethodArguments(methodArguments2 );
				grid.reconfigure(listStore, new ColumnModel(new ArrayList<ColumnConfig>()));
				
				final List<ColumnConfig> list = new LinkedList<ColumnConfig>();
				serviceInvoker.callService(gxtToSeamServiceParameter,
						new AsyncCallback<GxtToSeamServiceResult>() {

							@Override
							public void onSuccess(GxtToSeamServiceResult result) {
								List<BaseModel> bmBaseModels = new LinkedList<BaseModel>();
								ModelData modelData = result.getResult();
								bmBaseModels = modelData.get("listOfModelData");
															
								for (BaseModel baseModel : bmBaseModels) {
									ColumnConfig columnConfig = new ColumnConfig();
									columnConfig.setId((String)baseModel.get("id"));
									columnConfig.setHeader((String)baseModel.get("header"));
									columnConfig.setWidth((Integer)baseModel.get("width"));
									columnConfig.setEditor(new CellEditor(new TextField<String>()));
									list.add(columnConfig);
								}
								
								ColumnModel cm2  = new ColumnModel(list);
								grid.reconfigure(listStore, cm2);
								
							}

							@Override
							public void onFailure(Throwable caught) {
								System.out.println("------Rpc Exception is ####"+caught +"When get the Grid's ColumnModel");
								caught.printStackTrace();
							}
						});
			}
			else if ((Integer)(grid.getData("gridType"))==2) {
				//对于分组表格
				gxtToSeamServiceParameter.setServiceComponentName("com.hy.mydesktop.server.business.PersonService");
				gxtToSeamServiceParameter.setServiceMethodName("getGroupModleAll");
				BaseModel[] methodArguments = new BaseModel[1];
				methodArguments[0] = new BaseModel();
				gxtToSeamServiceParameter.setMethodArguments(methodArguments );	
				
	 
				//final  ListStore<ModelData> listStore = new ListStore<ModelData>(loader);
				final GroupingStore<ModelData> groupingStore = new GroupingStore<ModelData>();
				// store.add(Text.getCompanies());
				//groupingStore.groupBy("industry");

				
				final ColumnModel cm = grid.getColumnModel();
				
				
//				grid.reconfigure(groupingStore, new ColumnModel(new ArrayList<ColumnConfig>()));
//				grid.reconfigure(groupingStore, cm);
				
				final List<ColumnConfig> list = new LinkedList<ColumnConfig>();
				//设置显示行号
				if ((Boolean)(grid.getData("showRowNumberer"))!=null) {
					this.showRowNumber(grid, list);
				}
				
				serviceInvoker.callService(gxtToSeamServiceParameter,
						new AsyncCallback<GxtToSeamServiceResult>() {

							@Override
							public void onSuccess(GxtToSeamServiceResult result) {
								List<ModelData> bmBaseModels = new LinkedList<ModelData>();
								
								ModelData modelData = result.getResult();
								bmBaseModels = modelData.get("listOfModelData");
								ModelData headNode = bmBaseModels.get(0);
																;
								for (ModelData baseModel : bmBaseModels.subList((Integer)(headNode.get("configOffset")), (Integer)(headNode.get("configSize")))) {
									ColumnConfig columnConfig = new ColumnConfig();
									columnConfig.setId((String)baseModel.get("id"));
									columnConfig.setHeader((String)baseModel.get("header"));
									columnConfig.setWidth((Integer)baseModel.get("width"));
									columnConfig.setEditor(new CellEditor(new TextField<String>()));
									list.add(columnConfig);
								}
							
								ColumnModel cm2  = new ColumnModel(list);
								//TODO 设置显示行号
								if ((Boolean)(grid.getData("groupingView"))!=null) {
									//setGroupingView(grid,cm2);
								}
								
								groupingStore.add(bmBaseModels.subList((Integer)(headNode.get("dataOffset")),
										(Integer)(headNode.get("dataSize"))));
								System.err.println("$$$$$"+(String)(grid.getData("groupingColumnId")));
								groupingStore.groupBy((String)(grid.getData("groupingColumnId")));
								
								grid.reconfigure(groupingStore, cm2);
								
								
							}

							@Override
							public void onFailure(Throwable caught) {
								System.out.println("------Rpc Exception is ####"+caught +"When get the Grid's ColumnModel");
								caught.printStackTrace();
							}
						});
				gxtToSeamServiceParameter.setServiceComponentName("com.hy.mydesktop.server.business.PersonService");
				gxtToSeamServiceParameter.setServiceMethodName("getGroupModle");
				ModelData[] methodArguments = new BaseModelData[1];
				methodArguments[0] = new BaseModel();
				gxtToSeamServiceParameter.setMethodArguments(methodArguments );	
				 proxy = new RpcProxy<GxtToSeamServiceResult>(){

					@Override
					protected void load(Object loadConfig,
							AsyncCallback<GxtToSeamServiceResult> callback) {
						serviceInvoker.callService(gxtToSeamServiceParameter, callback);
					}};
				  
				loader =  new  BaseListLoader<BaseListLoadResult<ModelData>>(proxy,listReader);
	 
				//final  ListStore<ModelData> listStore = new ListStore<ModelData>(loader);
				final GroupingStore<ModelData> groupingStore = new GroupingStore<ModelData>(loader);
				// store.add(Text.getCompanies());
				//groupingStore.groupBy("industry");
				groupingStore.getLoader().load();
				
				//listStore.getLoader().load();
				final ColumnModel cm = grid.getColumnModel();
				gxtToSeamServiceParameter.setServiceComponentName("com.hy.mydesktop.server.business.PersonService");
				gxtToSeamServiceParameter.setServiceMethodName("listPerson33");
				ModelData[] methodArguments2 = new BaseModelData[1];
				methodArguments2[0] = new BaseModel();
//				gxtToSeamServiceParameter.setMethodArguments(methodArguments2 );
				grid.reconfigure(groupingStore, new ColumnModel(new ArrayList<ColumnConfig>()));
				grid.reconfigure(groupingStore, cm);
				
				final List<ColumnConfig> list = new LinkedList<ColumnConfig>();
				serviceInvoker.callService(gxtToSeamServiceParameter,
						new AsyncCallback<GxtToSeamServiceResult>() {

							@Override
							public void onSuccess(GxtToSeamServiceResult result) {
								List<BaseModel> bmBaseModels = new LinkedList<BaseModel>();
								
								ModelData modelData = result.getResult();
								bmBaseModels = modelData.get("listOfModelData");
															
								for (BaseModel baseModel : bmBaseModels) {
									ColumnConfig columnConfig = new ColumnConfig();
									columnConfig.setId((String)baseModel.get("id"));
									columnConfig.setHeader((String)baseModel.get("header"));
									columnConfig.setWidth((Integer)baseModel.get("width"));
									columnConfig.setEditor(new CellEditor(new TextField<String>()));
									list.add(columnConfig);
								}
								
								
								ColumnModel cm2  = new ColumnModel(list);
								grid.reconfigure(groupingStore, cm2);
								
							}

							@Override
							public void onFailure(Throwable caught) {
								System.out.println("------Rpc Exception is ####"+caught +"When get the Grid's ColumnModel");
								caught.printStackTrace();
							}
						});
				
			}
			else {
				//TODO 对于分页表格
				RpcProxy<PagingLoadResult<ModelData>> proxy = new RpcProxy<PagingLoadResult<ModelData>>() {
					@Override
					protected void load(Object loadConfig,
							AsyncCallback<PagingLoadResult<ModelData>> callback) {
						service.getPageGrid(table, (PagingLoadConfig) loadConfig,
								callback);
					}
				};

				pagingLoader = new BasePagingLoader<PagingLoadResult<ModelData>>(proxy);
				pagingLoader.setRemoteSort(true);

				ListStore<ModelData> store = new ListStore<ModelData>(pagingLoader);

				// 需要把toolbar加到面板上
				PagingToolBar toolBar = new PagingToolBar(45);  

				toolBar.bind(pagingLoader);
				toolBar.setShowToolTips(true);
				contentPanel.setBottomComponent(toolBar);
				store.getLoader().load();
				return store;
				
				
				proxy = new RpcProxy<GxtToSeamServiceResult>(){

					@Override
					protected void load(Object loadConfig,
							AsyncCallback<GxtToSeamServiceResult> callback) {
						//TODO 需要进行结构转换
						BaseModel[] methodArguments = new BaseModel[1];
						methodArguments[0] = new GridPagingLoadConfigModel();
						if (loadConfig instanceof PagingLoadConfig) {
							methodArguments[0] = new GridPagingLoadConfigModel(
									((PagingLoadConfig)loadConfig).getOffset(),	
									((PagingLoadConfig)loadConfig).getLimit()
								);
						}
						System.err.println("####GridDataLoadView####((PagingLoadConfig)loadConfig).getLimit()"+((PagingLoadConfig)loadConfig).getLimit());
						final GxtToSeamServiceParameter gxtToSeamServiceParameter = grid.getData("gxtToSeamServiceParameter");
						gxtToSeamServiceParameter.setServiceComponentName("com.hy.mydesktop.server.business.PersonService");22
						gxtToSeamServiceParameter.setServiceMethodName("listPage");
						gxtToSeamServiceParameter.setMethodArguments(methodArguments );	
						

						serviceInvoker.callService(gxtToSeamServiceParameter, callback);
					}};
				  
				pageLoader =  new  BasePagingLoader<PagingLoadResult<ModelData>>(proxy,pagingReader);
				
				final  ListStore<ModelData> listStore = new ListStore<ModelData>(pageLoader);
				
				// 需要把toolbar加到面板上
				PagingToolBar toolBar = new PagingToolBar(45);  

				toolBar.bind(pageLoader);
				toolBar.setShowToolTips(true);
				((ContentPanel)grid.getParent()).setBottomComponent(toolBar);
				listStore.getLoader().load();
				final ColumnModel cm = grid.getColumnModel();
				grid.setLoadMask(true);
				gxtToSeamServiceParameter.setServiceComponentName("com.hy.mydesktop.server.business.PersonService");
				gxtToSeamServiceParameter.setServiceMethodName("listPerson3");
				BaseModel[] methodArguments2 = new BaseModel[1];
				methodArguments2[0] = new BaseModel();
				gxtToSeamServiceParameter.setMethodArguments(methodArguments2 );
//				final PagingToolBar toolBar = new PagingToolBar(50);  
//				toolBar.bind(loader);  
//				((ContentPanel)grid.getParent()).setBottomComponent(toolBar);
				
				
				final List<ColumnConfig> list = new LinkedList<ColumnConfig>();
				//list = cm.getColumns();
				//设置显示行号
				if ((Boolean)(grid.getData("showRowNumberer"))!=null) {
					this.showRowNumber(grid, cm);
				}
				//grid.reconfigure(listStore, new ColumnModel(new ArrayList<ColumnConfig>()));
				//grid.reconfigure(new ListStore<ModelData>(), null);
				grid.reconfigure(listStore, cm);
			
				
				grid.addListener(Events.Attach, new Listener<GridEvent<ModelData>>() {   
				      public void handleEvent(GridEvent<ModelData> be) {   
				    	  pageLoader.load(0, 45);   
				      }   
				    });   
				//TODO 关于分页表格数据（加载后）无法正常显示的问题：疑似为PagingToolBar Store cm间的绑定关系
				serviceInvoker.callService(gxtToSeamServiceParameter,
						new AsyncCallback<GxtToSeamServiceResult>() {

							@Override
							public void onSuccess(GxtToSeamServiceResult result) {
								List<BaseModel> bmBaseModels = new LinkedList<BaseModel>();
								ModelData modelData = result.getResult();
								bmBaseModels = modelData.get("listOfModelData");
															
								for (BaseModel baseModel : bmBaseModels) {
									ColumnConfig columnConfig = new ColumnConfig();
									columnConfig.setId((String)baseModel.get("id"));
									columnConfig.setHeader((String)baseModel.get("header"));
									columnConfig.setWidth((Integer)baseModel.get("width"));
									columnConfig.setEditor(new CellEditor(new TextField<String>()));
									list.add(columnConfig);
								}
								
								ColumnModel cm2  = new ColumnModel(list);
								grid.reconfigure(listStore, cm);
								
							}

							@Override
							public void onFailure(Throwable caught) {
								System.out.println("------Rpc Exception is ####"+caught +"When get the Grid's ColumnModel");
								caught.printStackTrace();
							}
						});
				
				//listStore.getLoader().load();
			}
			
			
			
			
//			loader = this.getBasePagingLoader(gxtToSeamServiceParameter, reader);
//			 loader.setRemoteSort(true);

			//store.getLoader().load();
			// String loadConfig = "listOfModelData";
			*//**
			 * 先用RpcProxy加载表格中的数据
			 * 然后用原始的Rpc，加载ColumnConfig
			 *//*
			
//			loader.load(0, 10);

			
			//cm = this.loadeAndConfigurGridColumn(gxtToSeamServiceParameter);		
			//grid.reconfigure(null, cm);		
			//grid.reconfigure(employeeStore, cm);
//			grid.reconfigure(listStore, grid.getColumnModel());
			RpcProxy<PagingLoadResult<Post>> proxy = new RpcProxy<PagingLoadResult<Post>>() {   
			      @Override   
			      public void load(Object loadConfig, AsyncCallback<PagingLoadResult<Post>> callback) {   
			        service.getPosts((PagingLoadConfig) loadConfig, callback);   
			      }   
			    };   
			  
			    // loader   
			    final PagingLoader<PagingLoadResult<ModelData>> loader = new BasePagingLoader<PagingLoadResult<ModelData>>(   
			        proxy);   
			    loader.setRemoteSort(true);   
			  
			    ListStore<Post> store = new ListStore<Post>(loader);   
			  
			    final PagingToolBar toolBar = new PagingToolBar(50);   
			    toolBar.bind(loader);   
			  
			    List<ColumnConfig> columns = new ArrayList<ColumnConfig>();   
			    columns.add(new ColumnConfig("forum", "Forum", 150));   
			    columns.add(new ColumnConfig("username", "Username", 100));   
			    columns.add(new ColumnConfig("subject", "Subject", 200));   
			    ColumnConfig date = new ColumnConfig("date", "Date", 100);   
			    date.setDateTimeFormat(DateTimeFormat.getFormat("MM/dd/y"));   
			    columns.add(date);   
			  
			    ColumnModel cm = new ColumnModel(columns);   
			  
			    final Grid<Post> grid = new Grid<Post>(store, cm);   
			    grid.setStateId("pagingGridExample");   
			    grid.setStateful(true);   
			    grid.addListener(Events.Attach, new Listener<GridEvent<Post>>() {   
			      public void handleEvent(GridEvent<Post> be) {   
			        PagingLoadConfig config = new BasePagingLoadConfig();   
			        config.setOffset(0);   
			        config.setLimit(50);   
			           
			        Map<String, Object> state = grid.getState();   
			        if (state.containsKey("offset")) {   
			          int offset = (Integer)state.get("offset");   
			          int limit = (Integer)state.get("limit");   
			          config.setOffset(offset);   
			          config.setLimit(limit);   
			        }   
			        if (state.containsKey("sortField")) {   
			          config.setSortField((String)state.get("sortField"));   
			          config.setSortDir(SortDir.valueOf((String)state.get("sortDir")));   
			        }   
			        loader.load(config);   
			      }   
			    });   
			    grid.setLoadMask(true);   
			    grid.setBorders(true);   
			    grid.setAutoExpandColumn("forum");   
			
		}
		

		;
		// 0601
		if (AppEvents.GRID_RELOAD == event.getType()) {
			//拿到用于显示数据的表格
			//grid = (Grid<ModelData>) map.get("dataContainer");			
			System.out.println("GridDataLoadView---------  AppEvents.GRID_RELOAD");			
			//========================================================================		
//			loader = this.getBaseListLoader(gxtToSeamServiceParameter, reader);
			if (grid.getData("gridType")==null||(Integer)(grid.getData("gridType"))==1) {
				//对于可编辑表格
				
				//TODO 加载表格数据？？？？
//				final GxtToSeamServiceParameter gxtToSeamServiceParameter = grid.getData("gxtToSeamServiceParameter");
				EventStructureMetaModel eventStructureMetaModel = (EventStructureMetaModel)map.get("eventstructuremetamodel");
				ModelData eventData = eventStructureMetaModel.getEventData();
				BaseModel baseModel =  eventData.get("store");
				
				
				final GxtToSeamServiceParameter gxtToSeamServiceParameter = new GxtToSeamServiceParameter();
				this.parseGxtToSeamServiceParameter(gxtToSeamServiceParameter, baseModel);
				
				gxtToSeamServiceParameter.setServiceComponentName("com.hy.mydesktop.server.business.PersonService");
				gxtToSeamServiceParameter.setServiceMethodName("listPerson2");
				BaseModel[] methodArguments = new BaseModel[1];
				methodArguments[0] = new BaseModel();
				gxtToSeamServiceParameter.setMethodArguments(methodArguments );	
				 proxy = new RpcProxy<GxtToSeamServiceResult>(){

					@Override
					protected void load(Object loadConfig,
							AsyncCallback<GxtToSeamServiceResult> callback) {
						serviceInvoker.callService(gxtToSeamServiceParameter, callback);
					}};
				  
				loader =  new  BaseListLoader<BaseListLoadResult<ModelData>>(proxy,listReader);
	 
				final  ListStore<ModelData> listStore = new ListStore<ModelData>(loader);
				listStore.getLoader().load();
				final ColumnModel cm = grid.getColumnModel();
				grid.reconfigure(listStore, new ColumnModel(new ArrayList<ColumnConfig>()));
				//设置显示行号
				if ((Boolean)(grid.getData("showRowNumberer"))!=null) {
					//this.showRowNumber(grid, cm);
				}
				//grid.reconfigure(listStore, cm);
				listStore.getLoader().load();
				gxtToSeamServiceParameter.setServiceComponentName("com.hy.mydesktop.server.business.PersonService");
				gxtToSeamServiceParameter.setServiceMethodName("listPerson3");
				ModelData[] methodArguments2 = new BaseModelData[1];
				methodArguments2[0] = new BaseModel();
				gxtToSeamServiceParameter.setMethodArguments(methodArguments2 );
				final GxtToSeamServiceParameter gxtToSeamServiceParameter2 = new GxtToSeamServiceParameter();
				BaseModel baseModel2 = eventData.get("column");
				this.parseGxtToSeamServiceParameter(gxtToSeamServiceParameter2, baseModel2);

				grid.reconfigure(listStore, new ColumnModel(new ArrayList<ColumnConfig>()));
				
				final List<ColumnConfig> list = new LinkedList<ColumnConfig>();
				serviceInvoker.callService(gxtToSeamServiceParameter2,
						new AsyncCallback<GxtToSeamServiceResult>() {

							@Override
							public void onSuccess(GxtToSeamServiceResult result) {
								List<BaseModel> bmBaseModels = new LinkedList<BaseModel>();
								ModelData modelData = result.getResult();
								bmBaseModels = modelData.get("listOfModelData");
															
								for (BaseModel baseModel : bmBaseModels) {
									ColumnConfig columnConfig = new ColumnConfig();
									columnConfig.setId((String)baseModel.get("id"));
									columnConfig.setHeader((String)baseModel.get("header"));
									columnConfig.setWidth((Integer)baseModel.get("width"));
									columnConfig.setEditor(new CellEditor(new TextField<String>()));
									list.add(columnConfig);
								}
								
								ColumnModel cm2  = new ColumnModel(list);
								//设置显示行号
								if ((Boolean)(grid.getData("showRowNumberer"))!=null) {
									//showRowNumber(grid, cm2);
								}
								grid.reconfigure(listStore, cm2);
								
							}

							@Override
							public void onFailure(Throwable caught) {
								System.out.println("------Rpc Exception is ####"+caught +"When get the Grid's ColumnModel");
								caught.printStackTrace();
							}
						});
			}else if ((Integer)(grid.getData("gridType"))==2) {
				//对于分组表格
				gxtToSeamServiceParameter.setServiceComponentName("com.hy.mydesktop.server.business.PersonService");
				gxtToSeamServiceParameter.setServiceMethodName("getGroupModleAll");
				BaseModel[] methodArguments = new BaseModel[1];
				methodArguments[0] = new BaseModel();
				gxtToSeamServiceParameter.setMethodArguments(methodArguments );	
				
	 
				//final  ListStore<ModelData> listStore = new ListStore<ModelData>(loader);
				final GroupingStore<ModelData> groupingStore = new GroupingStore<ModelData>();
				// store.add(Text.getCompanies());
				//groupingStore.groupBy("industry");

				
				final ColumnModel cm = grid.getColumnModel();
				
				
//				grid.reconfigure(groupingStore, new ColumnModel(new ArrayList<ColumnConfig>()));
//				grid.reconfigure(groupingStore, cm);
				
				final List<ColumnConfig> list = new LinkedList<ColumnConfig>();
				//设置显示行号
				if ((Boolean)(grid.getData("showRowNumberer"))!=null) {
					this.showRowNumber(grid, list);
				}
				
				serviceInvoker.callService(gxtToSeamServiceParameter,
						new AsyncCallback<GxtToSeamServiceResult>() {

							@Override
							public void onSuccess(GxtToSeamServiceResult result) {
								List<ModelData> bmBaseModels = new LinkedList<ModelData>();
								
								ModelData modelData = result.getResult();
								bmBaseModels = modelData.get("listOfModelData");
								ModelData headNode = bmBaseModels.get(0);
																;
								for (ModelData baseModel : bmBaseModels.subList((Integer)(headNode.get("configOffset")), (Integer)(headNode.get("configSize")))) {
									ColumnConfig columnConfig = new ColumnConfig();
									columnConfig.setId((String)baseModel.get("id"));
									columnConfig.setHeader((String)baseModel.get("header"));
									columnConfig.setWidth((Integer)baseModel.get("width"));
									columnConfig.setEditor(new CellEditor(new TextField<String>()));
									list.add(columnConfig);
								}
							
								ColumnModel cm2  = new ColumnModel(list);
								//TODO 设置显示行号
								if ((Boolean)(grid.getData("groupingView"))!=null) {
									//setGroupingView(grid,cm2);
								}
								
								groupingStore.add(bmBaseModels.subList((Integer)(headNode.get("dataOffset")),
										(Integer)(headNode.get("dataSize"))));
								System.err.println("$$$$$"+(String)(grid.getData("groupingColumnId")));
								groupingStore.groupBy((String)(grid.getData("groupingColumnId")));
								
								grid.reconfigure(groupingStore, cm2);
								
								
							}

							@Override
							public void onFailure(Throwable caught) {
								System.out.println("------Rpc Exception is ####"+caught +"When get the Grid's ColumnModel");
								caught.printStackTrace();
							}
						});
				gxtToSeamServiceParameter.setServiceComponentName("com.hy.mydesktop.server.business.PersonService");
				gxtToSeamServiceParameter.setServiceMethodName("getGroupModle");
				ModelData[] methodArguments = new BaseModelData[1];
				methodArguments[0] = new BaseModel();
				gxtToSeamServiceParameter.setMethodArguments(methodArguments );	
				 proxy = new RpcProxy<GxtToSeamServiceResult>(){

					@Override
					protected void load(Object loadConfig,
							AsyncCallback<GxtToSeamServiceResult> callback) {
						serviceInvoker.callService(gxtToSeamServiceParameter, callback);
					}};
				  
				loader =  new  BaseListLoader<BaseListLoadResult<ModelData>>(proxy,listReader);
	 
				//final  ListStore<ModelData> listStore = new ListStore<ModelData>(loader);
				final GroupingStore<ModelData> groupingStore = new GroupingStore<ModelData>(loader);
				// store.add(Text.getCompanies());
				//groupingStore.groupBy("industry");
				groupingStore.getLoader().load();
				
				//listStore.getLoader().load();
				final ColumnModel cm = grid.getColumnModel();
				gxtToSeamServiceParameter.setServiceComponentName("com.hy.mydesktop.server.business.PersonService");
				gxtToSeamServiceParameter.setServiceMethodName("listPerson33");
				ModelData[] methodArguments2 = new BaseModelData[1];
				methodArguments2[0] = new BaseModel();
//				gxtToSeamServiceParameter.setMethodArguments(methodArguments2 );
				grid.reconfigure(groupingStore, new ColumnModel(new ArrayList<ColumnConfig>()));
				grid.reconfigure(groupingStore, cm);
				
				final List<ColumnConfig> list = new LinkedList<ColumnConfig>();
				serviceInvoker.callService(gxtToSeamServiceParameter,
						new AsyncCallback<GxtToSeamServiceResult>() {

							@Override
							public void onSuccess(GxtToSeamServiceResult result) {
								List<BaseModel> bmBaseModels = new LinkedList<BaseModel>();
								
								ModelData modelData = result.getResult();
								bmBaseModels = modelData.get("listOfModelData");
															
								for (BaseModel baseModel : bmBaseModels) {
									ColumnConfig columnConfig = new ColumnConfig();
									columnConfig.setId((String)baseModel.get("id"));
									columnConfig.setHeader((String)baseModel.get("header"));
									columnConfig.setWidth((Integer)baseModel.get("width"));
									columnConfig.setEditor(new CellEditor(new TextField<String>()));
									list.add(columnConfig);
								}
								
								
								ColumnModel cm2  = new ColumnModel(list);
								grid.reconfigure(groupingStore, cm2);
								
							}

							@Override
							public void onFailure(Throwable caught) {
								System.out.println("------Rpc Exception is ####"+caught +"When get the Grid's ColumnModel");
								caught.printStackTrace();
							}
						});
				
			}
			else {
				//TODO 对于分页表格
				RpcProxy<PagingLoadResult<ModelData>> proxy = new RpcProxy<PagingLoadResult<ModelData>>() {
					@Override
					protected void load(Object loadConfig,
							AsyncCallback<PagingLoadResult<ModelData>> callback) {
						service.getPageGrid(table, (PagingLoadConfig) loadConfig,
								callback);
					}
				};

				pagingLoader = new BasePagingLoader<PagingLoadResult<ModelData>>(proxy);
				pagingLoader.setRemoteSort(true);

				ListStore<ModelData> store = new ListStore<ModelData>(pagingLoader);

				// 需要把toolbar加到面板上
				PagingToolBar toolBar = new PagingToolBar(45);  

				toolBar.bind(pagingLoader);
				toolBar.setShowToolTips(true);
				contentPanel.setBottomComponent(toolBar);
				store.getLoader().load();
				return store;
				
				
				proxy = new RpcProxy<GxtToSeamServiceResult>(){

					@Override
					protected void load(Object loadConfig,
							AsyncCallback<GxtToSeamServiceResult> callback) {
						//TODO 需要进行结构转换
						BaseModel[] methodArguments = new BaseModel[1];
						methodArguments[0] = new GridPagingLoadConfigModel();
						if (loadConfig instanceof PagingLoadConfig) {
							methodArguments[0] = new GridPagingLoadConfigModel(
									((PagingLoadConfig)loadConfig).getOffset(),	
									((PagingLoadConfig)loadConfig).getLimit()
								);
						}
						System.err.println("####GridDataLoadView####((PagingLoadConfig)loadConfig).getLimit()"+((PagingLoadConfig)loadConfig).getLimit());
						final GxtToSeamServiceParameter gxtToSeamServiceParameter = grid.getData("gxtToSeamServiceParameter");
						gxtToSeamServiceParameter.setServiceComponentName("com.hy.mydesktop.server.business.PersonService");22
						gxtToSeamServiceParameter.setServiceMethodName("listPage");
						gxtToSeamServiceParameter.setMethodArguments(methodArguments );	
						

						serviceInvoker.callService(gxtToSeamServiceParameter, callback);
					}};
				  
				pageLoader =  new  BasePagingLoader<PagingLoadResult<ModelData>>(proxy,pagingReader);
				
				final  ListStore<ModelData> listStore = new ListStore<ModelData>(pageLoader);
				
				// 需要把toolbar加到面板上
				PagingToolBar toolBar = new PagingToolBar(45);  

				toolBar.bind(pageLoader);
				toolBar.setShowToolTips(true);
				((ContentPanel)grid.getParent()).setBottomComponent(toolBar);
				listStore.getLoader().load();
				final ColumnModel cm = grid.getColumnModel();
				grid.setLoadMask(true);
				gxtToSeamServiceParameter.setServiceComponentName("com.hy.mydesktop.server.business.PersonService");
				gxtToSeamServiceParameter.setServiceMethodName("listPerson3");
				BaseModel[] methodArguments2 = new BaseModel[1];
				methodArguments2[0] = new BaseModel();
				gxtToSeamServiceParameter.setMethodArguments(methodArguments2 );
//				final PagingToolBar toolBar = new PagingToolBar(50);  
//				toolBar.bind(loader);  
//				((ContentPanel)grid.getParent()).setBottomComponent(toolBar);
				
				
				final List<ColumnConfig> list = new LinkedList<ColumnConfig>();
				//list = cm.getColumns();
				//设置显示行号
				if ((Boolean)(grid.getData("showRowNumberer"))!=null) {
					this.showRowNumber(grid, cm);
				}
				//grid.reconfigure(listStore, new ColumnModel(new ArrayList<ColumnConfig>()));
				//grid.reconfigure(new ListStore<ModelData>(), null);
				grid.reconfigure(listStore, cm);
			
				
				grid.addListener(Events.Attach, new Listener<GridEvent<ModelData>>() {   
				      public void handleEvent(GridEvent<ModelData> be) {   
				    	  pageLoader.load(0, 45);   
				      }   
				    });   
				//TODO 关于分页表格数据（加载后）无法正常显示的问题：疑似为PagingToolBar Store cm间的绑定关系
				serviceInvoker.callService(gxtToSeamServiceParameter,
						new AsyncCallback<GxtToSeamServiceResult>() {

							@Override
							public void onSuccess(GxtToSeamServiceResult result) {
								List<BaseModel> bmBaseModels = new LinkedList<BaseModel>();
								ModelData modelData = result.getResult();
								bmBaseModels = modelData.get("listOfModelData");
															
								for (BaseModel baseModel : bmBaseModels) {
									ColumnConfig columnConfig = new ColumnConfig();
									columnConfig.setId((String)baseModel.get("id"));
									columnConfig.setHeader((String)baseModel.get("header"));
									columnConfig.setWidth((Integer)baseModel.get("width"));
									columnConfig.setEditor(new CellEditor(new TextField<String>()));
									list.add(columnConfig);
								}
								
								ColumnModel cm2  = new ColumnModel(list);
								grid.reconfigure(listStore, cm);
								
							}

							@Override
							public void onFailure(Throwable caught) {
								System.out.println("------Rpc Exception is ####"+caught +"When get the Grid's ColumnModel");
								caught.printStackTrace();
							}
						});
				
				//listStore.getLoader().load();
			}
			
			
			
			
//			loader = this.getBasePagingLoader(gxtToSeamServiceParameter, reader);
//			 loader.setRemoteSort(true);

			//store.getLoader().load();
			// String loadConfig = "listOfModelData";
			*//**
			 * 先用RpcProxy加载表格中的数据
			 * 然后用原始的Rpc，加载ColumnConfig
			 *//*
			
//			loader.load(0, 10);

			
			//cm = this.loadeAndConfigurGridColumn(gxtToSeamServiceParameter);		
			//grid.reconfigure(null, cm);		
			//grid.reconfigure(employeeStore, cm);
//			grid.reconfigure(listStore, grid.getColumnModel());
			RpcProxy<PagingLoadResult<Post>> proxy = new RpcProxy<PagingLoadResult<Post>>() {   
			      @Override   
			      public void load(Object loadConfig, AsyncCallback<PagingLoadResult<Post>> callback) {   
			        service.getPosts((PagingLoadConfig) loadConfig, callback);   
			      }   
			    };   
			  
			    // loader   
			    final PagingLoader<PagingLoadResult<ModelData>> loader = new BasePagingLoader<PagingLoadResult<ModelData>>(   
			        proxy);   
			    loader.setRemoteSort(true);   
			  
			    ListStore<Post> store = new ListStore<Post>(loader);   
			  
			    final PagingToolBar toolBar = new PagingToolBar(50);   
			    toolBar.bind(loader);   
			  
			    List<ColumnConfig> columns = new ArrayList<ColumnConfig>();   
			    columns.add(new ColumnConfig("forum", "Forum", 150));   
			    columns.add(new ColumnConfig("username", "Username", 100));   
			    columns.add(new ColumnConfig("subject", "Subject", 200));   
			    ColumnConfig date = new ColumnConfig("date", "Date", 100);   
			    date.setDateTimeFormat(DateTimeFormat.getFormat("MM/dd/y"));   
			    columns.add(date);   
			  
			    ColumnModel cm = new ColumnModel(columns);   
			  
			    final Grid<Post> grid = new Grid<Post>(store, cm);   
			    grid.setStateId("pagingGridExample");   
			    grid.setStateful(true);   
			    grid.addListener(Events.Attach, new Listener<GridEvent<Post>>() {   
			      public void handleEvent(GridEvent<Post> be) {   
			        PagingLoadConfig config = new BasePagingLoadConfig();   
			        config.setOffset(0);   
			        config.setLimit(50);   
			           
			        Map<String, Object> state = grid.getState();   
			        if (state.containsKey("offset")) {   
			          int offset = (Integer)state.get("offset");   
			          int limit = (Integer)state.get("limit");   
			          config.setOffset(offset);   
			          config.setLimit(limit);   
			        }   
			        if (state.containsKey("sortField")) {   
			          config.setSortField((String)state.get("sortField"));   
			          config.setSortDir(SortDir.valueOf((String)state.get("sortDir")));   
			        }   
			        loader.load(config);   
			      }   
			    });   
			    grid.setLoadMask(true);   
			    grid.setBorders(true);   
			    grid.setAutoExpandColumn("forum");   
			
		}
		;
		

	}

	private GxtComponentMetaModel getDesktopMetaModel_Shortcut() {
		Map<String, Object> map1 = new HashMap<String, Object>();
		map1.put("component_model_type", ComponentTypeEnum.DESKTOP_MODEL);
		GxtComponentMetaNodeModel node1 = new GxtComponentMetaNodeModel(map1,
				1, 6);

		Map<String, Object> map2 = new HashMap<String, Object>();
		map2.put("component_model_type", ComponentTypeEnum.SHORTCUT_MODEL);
		// TODO map2.put("appEventType",
		// AppEvents.DESKTOP_SHORTCUT_ONCLICK_INIT);
		map2.put("appEventType", AppEvents.DESKTOP_SHORTCUT_ONCLICK_INIT);
		GxtComponentMetaNodeModel node2 = new GxtComponentMetaNodeModel(map2,
				2, 3);

		Map<String, Object> map3 = new HashMap<String, Object>();
		map3.put("component_model_type", ComponentTypeEnum.SHORTCUT_MODEL);
		GxtComponentMetaNodeModel node3 = new GxtComponentMetaNodeModel(map3,
				4, 5);

		List<GxtComponentMetaNodeModel> list = new ArrayList<GxtComponentMetaNodeModel>();
		list.add(node1);
		list.add(node2);
		list.add(node3);
		GxtComponentMetaModel gxtComponentMetaModel = new GxtComponentMetaModel();
		gxtComponentMetaModel.setList(list);

		return gxtComponentMetaModel;

	}

	private GxtComponentMetaModel getDesktopMetaModel() {
		Map<String, Object> map1 = new HashMap<String, Object>();
		map1.put("component_model_type", ComponentTypeEnum.DESKTOP_MODEL);
		GxtComponentMetaNodeModel node1 = new GxtComponentMetaNodeModel(map1,
				1, 6);

		Map<String, Object> map2 = new HashMap<String, Object>();
		map2.put("component_model_type", ComponentTypeEnum.SHORTCUT_MODEL);
		// TODO map2.put("appEventType",
		// AppEvents.DESKTOP_SHORTCUT_ONCLICK_INIT);
		map2.put("appEventType", AppEvents.DESKTOP_SHORTCUT_ONCLICK_INIT);
		GxtComponentMetaNodeModel node2 = new GxtComponentMetaNodeModel(map2,
				2, 3);

		Map<String, Object> map3 = new HashMap<String, Object>();
		map3.put("component_model_type", ComponentTypeEnum.SHORTCUT_MODEL);
		GxtComponentMetaNodeModel node3 = new GxtComponentMetaNodeModel(map3,
				4, 5);

		List<GxtComponentMetaNodeModel> list = new ArrayList<GxtComponentMetaNodeModel>();
		list.add(node1);
		list.add(node2);
		list.add(node3);
		GxtComponentMetaModel gxtComponentMetaModel = new GxtComponentMetaModel();
		gxtComponentMetaModel.setList(list);

		return gxtComponentMetaModel;

	}

	*//**
	 * 模拟调用后台逻辑后，传回来的对象
	 *//*
	private Window createGridWindow() {
		Window w = new Window();
		w.setIcon(IconHelper.createStyle("icon-grid"));
		w.setMinimizable(true);
		w.setMaximizable(true);
		w.setHeading("Grid Window");
		w.setSize(500, 400);
		w.setLayout(new FitLayout());

		w.setId("999");

		GroupingStore<Stock> store = new GroupingStore<Stock>();
		store.add(TestData.getCompanies());
		store.groupBy("industry");

		ColumnConfig company = new ColumnConfig("name", "Company", 60);
		ColumnConfig price = new ColumnConfig("open", "Price", 20);
		price.setNumberFormat(NumberFormat.getCurrencyFormat());
		ColumnConfig change = new ColumnConfig("change", "Change", 20);
		ColumnConfig industry = new ColumnConfig("industry", "Industry", 20);
		ColumnConfig last = new ColumnConfig("date", "Last Updated", 20);
		last.setDateTimeFormat(DateTimeFormat.getFormat("MM/dd/y"));

		List<ColumnConfig> config = new ArrayList<ColumnConfig>();
		config.add(company);
		config.add(price);
		config.add(change);
		config.add(industry);
		config.add(last);

		final ColumnModel cm = new ColumnModel(config);

		GroupingView view = new GroupingView();
		view.setForceFit(true);
		view.setGroupRenderer(new GridGroupRenderer() {
			public String render(GroupColumnData data) {
				String f = cm.getColumnById(data.field).getHeader();
				String l = data.models.size() == 1 ? "Item" : "Items";
				return f + ": " + data.group + " (" + data.models.size() + " "
						+ l + ")";
			}
		});

		Grid<Stock> grid = new Grid<Stock>(store, cm);
		grid.setView(view);
		grid.setBorders(true);

		w.add(grid);
		return w;
	}

	*//**
	 * 模拟调用后台逻辑后，传回来的对象
	 *//*
	private Window createGridWindow2() {
		Window w = new Window();
		w.setIcon(IconHelper.createStyle("icon-grid"));
		w.setMinimizable(true);
		w.setMaximizable(true);
		w.setHeading("Grid Window222222");
		w.setSize(500, 400);
		w.setLayout(new FitLayout());

		GroupingStore<Stock> store = new GroupingStore<Stock>();
		store.add(TestData.getCompanies());
		store.groupBy("industry");

		ColumnConfig company = new ColumnConfig("name", "Company", 60);
		ColumnConfig price = new ColumnConfig("open", "Price", 20);
		price.setNumberFormat(NumberFormat.getCurrencyFormat());
		ColumnConfig change = new ColumnConfig("change", "Change", 20);
		ColumnConfig industry = new ColumnConfig("industry", "Industry", 20);
		ColumnConfig last = new ColumnConfig("date", "Last Updated", 20);
		last.setDateTimeFormat(DateTimeFormat.getFormat("MM/dd/y"));

		List<ColumnConfig> config = new ArrayList<ColumnConfig>();
		config.add(company);
		config.add(price);
		config.add(change);
		config.add(industry);
		config.add(last);

		final ColumnModel cm = new ColumnModel(config);

		GroupingView view = new GroupingView();
		view.setForceFit(true);
		view.setGroupRenderer(new GridGroupRenderer() {
			public String render(GroupColumnData data) {
				String f = cm.getColumnById(data.field).getHeader();
				String l = data.models.size() == 1 ? "Item" : "Items";
				return f + ": " + data.group + " (" + data.models.size() + " "
						+ l + ")";
			}
		});

		Grid<Stock> grid = new Grid<Stock>(store, cm);
		grid.setView(view);
		grid.setBorders(true);

		w.add(grid);
		return w;
	}

	*//**
	 * 模拟从后台传过来的关于Shortcut控件的元模型信息
	 *//*
	private GxtComponentMetaNodeModel getGxtComponentMetaNodeModel2() {
		Map<String, Object> map2 = new HashMap<String, Object>();
		map2.put("component_model_type", ComponentTypeEnum.SHORTCUT_MODEL);
		// TODO map2.put("appEventType",
		// AppEvents.DESKTOP_SHORTCUT_ONCLICK_INIT);
		map2.put("appEventType", AppEvents.DESKTOP_SHORTCUT_ONCLICK_INIT);
		Map<String, Object> codes2 = new HashMap<String, Object>();
		// 添加需要监听的事件类型，指定由某一个控制器响应，控制器内部应该如何响应（附加参数和数据）
		*//**
		 * 00_01_02为特征码
		 * 或者是 控制器的唯一标识
		 *//*
		Map<String, Object> subMap = new HashMap<String, Object>();
		EventStructureMetaModel eventStructureMetaModel = new EventStructureMetaModel();
		eventStructureMetaModel.setControllerId("shortcutController02");
		eventStructureMetaModel.setResponseModeId("00_02_02");
		subMap.put("eventstructuremetamodel", eventStructureMetaModel);
		codes2.put("0003", subMap);
		// codes1.add("0002");
		map2.put("registereventtypes", codes2);
		map2
				.put(
						"text",
						"2222222222createWindow-----LoginView----AppEvents.DESKTOP_INIT_FOR_LOGGED_IN_USER");
		GxtComponentMetaNodeModel node2 = new GxtComponentMetaNodeModel(map2);
		return node2;
	}

	*//**
	 * 模拟从后台传过来的关于Shortcut控件的元模型信息
	 *//*
	private GxtComponentMetaNodeModel getGxtComponentMetaNodeModel() {
		Map<String, Object> map2 = new HashMap<String, Object>();
		map2.put("component_model_type", ComponentTypeEnum.SHORTCUT_MODEL);
		// TODO map2.put("appEventType",
		// AppEvents.DESKTOP_SHORTCUT_ONCLICK_INIT);
		map2.put("appEventType", AppEvents.DESKTOP_SHORTCUT_ONCLICK_INIT);
		Map<String, Object> codes2 = new HashMap<String, Object>();
		// 添加需要监听的事件类型，指定由某一个控制器响应，控制器内部应该如何响应（附加参数和数据）
		*//**
		 * 00_01_02为特征码
		 * 或者是 控制器的唯一标识
		 *//*
		Map<String, Object> subMap = new HashMap<String, Object>();
		EventStructureMetaModel eventStructureMetaModel = new EventStructureMetaModel();
		eventStructureMetaModel.setControllerId("shortcutController01");
		eventStructureMetaModel.setResponseModeId("00_01_02");
		subMap.put("eventstructuremetamodel", eventStructureMetaModel);
		codes2.put("0003", subMap);
		// codes1.add("0002");
		map2.put("registereventtypes", codes2);
		map2
				.put(
						"text",
						"11111111111createWindow-----LoginView----AppEvents.DESKTOP_INIT_FOR_LOGGED_IN_USER");
		GxtComponentMetaNodeModel node2 = new GxtComponentMetaNodeModel(map2);
		return node2;
	}

//	private ListLoader<BaseListLoadResult<ModelData>> getLoader(final GxtToSeamServiceParameter gxtToSeamServiceParameter,final DataReader<ModelData> reader) {
		private BasePagingLoader<PagingLoadResult<ModelData>> getLoader(final GxtToSeamServiceParameter gxtToSeamServiceParameter,final DataReader<ModelData> reader) {
		 proxy = new RpcProxy<GxtToSeamServiceResult>(){

				@Override
				protected void load(Object loadConfig,
						AsyncCallback<GxtToSeamServiceResult> callback) {
					serviceInvoker.callService(gxtToSeamServiceParameter, callback);
				}};
			  
//			 return new  BaseListLoader<BaseListLoadResult<ModelData>>(proxy,reader);
			 return new  BasePagingLoader<PagingLoadResult<ModelData>>(proxy,reader);
	}
		
		
//		private ListLoader<BaseListLoadResult<ModelData>> getLoader(final GxtToSeamServiceParameter gxtToSeamServiceParameter,final DataReader<ModelData> reader) {
		private BasePagingLoader<PagingLoadResult<ModelData>> getBasePagingLoader(final GxtToSeamServiceParameter gxtToSeamServiceParameter,final DataReader<ModelData> reader) {
		 proxy = new RpcProxy<GxtToSeamServiceResult>(){

				@Override
				protected void load(Object loadConfig,
						AsyncCallback<GxtToSeamServiceResult> callback) {
					serviceInvoker.callService(gxtToSeamServiceParameter, callback);
				}};
			  
//			 return new  BaseListLoader<BaseListLoadResult<ModelData>>(proxy,reader);
			 return new  BasePagingLoader<PagingLoadResult<ModelData>>(proxy,reader);
	}
		
	
	private BaseListLoader<BaseListLoadResult<ModelData>> getBaseListLoader(final GxtToSeamServiceParameter gxtToSeamServiceParameter,final DataReader<ModelData> reader) {
	
		 proxy = new RpcProxy<GxtToSeamServiceResult>(){

				@Override
				protected void load(Object loadConfig,
						AsyncCallback<GxtToSeamServiceResult> callback) {
					serviceInvoker.callService(gxtToSeamServiceParameter, callback);
				}};
			  
			 return new  BaseListLoader<BaseListLoadResult<ModelData>>(proxy,reader);

	}
	
	private ColumnModel loadeAndConfigurGridColumn(final GxtToSeamServiceParameter gxtToSeamServiceParameter) {
		final List<ColumnConfig> list = new LinkedList<ColumnConfig>();
		serviceInvoker.callService(gxtToSeamServiceParameter,
				new AsyncCallback<GxtToSeamServiceResult>() {

					@Override
					public void onSuccess(GxtToSeamServiceResult result) {
						System.out.println(result
								+ "++++++++++++++++++++++ is serviceInvoker.callService");
						List<BaseModel> bmBaseModels = new LinkedList<BaseModel>();
						ModelData modelData = result.getResult();
						bmBaseModels = modelData.get("listOfModelData");
						
						
						for (BaseModel baseModel : bmBaseModels) {
							ColumnConfig columnConfig = new ColumnConfig();
							System.err.println("$$$$$$$$$$$$$$$$$$$$$$$$"+baseModel.get("id"));
							columnConfig.setId((String)baseModel.get("id"));
							System.err.println("$$$$$$$$$$$$$$$$$$$$$$$$"+baseModel.get("header"));
							columnConfig.setHeader((String)baseModel.get("header"));
							//System.err.println("$$$$$$$$$$$$$$$$$$$$$$$$"+((GridColumnConfigModel)baseModel).getWidth());
							columnConfig.setWidth((Integer)baseModel.get("width"));
							list.add(columnConfig);
						}
						
						System.err.println("((((((((((((((()))))))))))))"+list.size());
						for (ColumnConfig columnConfig : list) {
							System.err.println("((((((((((((((()))))))))))))"+columnConfig.getId());
						}
					}

					@Override
					public void onFailure(Throwable caught) {
						System.out.println("------Rpc Exception is -----------"+caught);
					}
				});
		
		ColumnModel cm2 = new ColumnModel(list);
		
		System.err.println(")))))))))))))"+cm2.getColumnCount());
		for (int i = 0; i < cm2.getColumnCount(); i++) {
			System.err.println("))))))))))))))"+cm2.getColumn(i));
		}
		return cm2;
	}
	
	*//**
	 * 
	 * <ul>
	 * <li>方法含义：为表格中的数据设置行号</li>
	 * <li>方法作者：花宏宇</li>
	 * <li>编写日期：2010-10-21；时间：下午下午03:12:15</li>
	 * </ul>
	 * <ul>
	 * <b>修订编号：</b>
	 * <li>修订日期：</li>
	 * <li>修订作者：</li>
	 * <li>修订原因：</li>
	 * <li>修订内容：</li>
	 * </ul>
	 * @param grid
	 * @param configs
	 *//*
	private void showRowNumber(Grid<ModelData> grid,List<ColumnConfig> configs){
		RowNumberer showRowNumberer = new RowNumberer();
		configs.add(0,showRowNumberer);
		MyLoggerUtil.printError(getClass(), "zzzzzzzzzzzzzzzz");
		//grid.addPlugin(showRowNumberer);
	}
	
	*//**
	 * 
	 * <ul>
	 * <li>方法含义：</li>
	 * <li>方法作者：花宏宇</li>
	 * <li>编写日期：2010-11-15；时间：下午下午04:42:44</li>
	 * </ul>
	 * <ul>
	 * <b>修订编号：</b>
	 * <li>修订日期：</li>
	 * <li>修订作者：</li>
	 * <li>修订原因：</li>
	 * <li>修订内容：</li>
	 * </ul>
	 * @param grid
	 * @param cm
	 *//*
	private void showRowNumber(Grid<ModelData> grid,ColumnModel cm){
		this.showRowNumber(grid, cm.getColumns());
	}
	
	
	*//**
	 * 
	 * <ul>
	 * <li>方法含义：为分组表格设置分组视图</li>
	 * <li>方法作者：花宏宇</li>
	 * <li>编写日期：2010-10-21；时间：下午下午03:12:48</li>
	 * </ul>
	 * <ul>
	 * <b>修订编号：</b>
	 * <li>修订日期：</li>
	 * <li>修订作者：</li>
	 * <li>修订原因：</li>
	 * <li>修订内容：</li>
	 * </ul>
	 *//*
	private void setGroupingView(final Grid<ModelData> grid,final ColumnModel cm) {
		GroupingView view = new GroupingView();
		view.setShowGroupedColumn(false);
		view.setForceFit(true);
		//分组表格中，一个分组内的表头信息
		view.setGroupRenderer(new GridGroupRenderer() {
			public String render(GroupColumnData data) {
				//String f = cm.getColumnById(data.field).getHeader();
				
				String l = data.models.size() == 1 ? "Item" : "Items";
				return "f" + ": " + data.group + " (" + data.models.size()
						+ " " + l + ")";
			}
		});
		grid.setView(view);
	}

	private void parseGxtToSeamServiceParameter(GxtToSeamServiceParameter gxtToSeamServiceParameter,BaseModel baseModel) {
		
		
		//GxtToSeamServiceParameter gxtToSeamServiceParameter = new GxtToSeamServiceParameter();
		gxtToSeamServiceParameter.setServiceComponentName((String)(baseModel.get("serviceComponentName")));
		gxtToSeamServiceParameter.setServiceMethodName((String)(baseModel.get("serviceMethodName")));
//		gxtToSeamServiceParameter.setServiceMethodName("getList2");
//		gxtToSeamServiceParameter.setServiceMethodName("getEnums");
		ModelData[] methodArguments2 = new BaseModel[1];
		methodArguments2[0] = new BaseModel();
		gxtToSeamServiceParameter.setMethodArguments((BaseModel[])(baseModel.get("methodArguments")) );
	}

	@Override
	public void bind() {
		// TODO Auto-generated method stub
		
	}
	
	
	
}*/
